<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListSalesOrderEntityTitle}"></h:outputText>
        </ui:define>
        <ui:define name="content">
            <h:form prependId="false" rendered="#{loginBacking.viewAllSalesOrder}">
                <p:panel header="#{bundle.ListSalesOrderEntityTitle} all Sales Orders">
                    <p:messages />
                    <br />
                    <h:outputText escape="false" value="#{bundle.ListSalesOrderEntityEmpty}" rendered="#{salesOrderEntityController.searchItems.rowCount == 0}"/>
                    <h:panelGroup rendered="#{salesOrderEntityController.searchItems.rowCount > 0}">
                        <h:outputText value="#{salesOrderEntityController.pagination.pageFirstItem + 1}..#{salesOrderEntityController.pagination.pageLastItem + 1}/#{salesOrderEntityController.pagination.itemsCount}"/>&nbsp;
                        <h:commandLink action="#{salesOrderEntityController.previous}" value="#{bundle.Previous} #{salesOrderEntityController.pagination.pageSize}" rendered="#{salesOrderEntityController.pagination.hasPreviousPage}"/>&nbsp;
                        <h:commandLink action="#{salesOrderEntityController.next}" value="#{bundle.Next} #{salesOrderEntityController.pagination.pageSize}" rendered="#{salesOrderEntityController.pagination.hasNextPage}"/>&nbsp;
                        <p:dataTable value="#{salesOrderEntityController.searchItems}" 
                                     var="item" style="table-layout:fixed"
                                     paginator="true" rows="10"  
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                     rowsPerPageTemplate="5,10,15">
                            <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListSalesOrderEntityTitle_id}"/>
                            </f:facet>
                            <h:outputText value="#{item.id}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSalesOrderEntityTitle_purchaseOrder}"/>
                                </f:facet>
                                <h:outputText value="#{item.purchaseOrder}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSalesOrderEntityTitle_customer}"/>
                                </f:facet>
                                <h:outputText value="#{item.customer}"/>
                            </p:column>
                            <p:column >
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSalesOrderEntityTitle_systemUser}"/>
                                </f:facet>
                                <h:outputText value="#{item.systemUser}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSalesOrderEntityTitle_createdBy}"/>
                                </f:facet>
                                <h:outputText value="#{item.createdBy}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSalesOrderEntityTitle_createdAt}"/>
                                </f:facet>
                                <h:outputText value="#{item.createdAt}">
                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                </h:outputText>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <p:commandButton image="ui-icon ui-icon-search" action="#{salesOrderEntityController.prepareView}" ajax="false"/>
                            </p:column>
                            <p:column>
                                <p:menuButton value="Options"> 
                                    <p:menuitem ajax="false" action="#{salesOrderEntityController.prepareEdit}" value="#{bundle.ListSalesOrderEntityEditLink}"/>
                                    <p:menuitem ajax="false" action="#{salesOrderEntityController.destroy}" value="Delete" rendered="#{loginBacking.deleteSalesOrder}"/>
                                </p:menuButton>
                            </p:column>
                        </p:dataTable>
                    </h:panelGroup>
                    <br />
                    <p:commandButton ajax="false" action="/entities/purchaseOrderEntity/Search" value="Search Again" immediate="true"/>
                    <br />
                    <br />
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
